package com.songcha.module_main.ui.dialog

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.TextView
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.songcha.library_common.ui.dialog.CustomDialog
import com.songcha.library_common.util.GlideUtil
import com.songcha.library_common.util.dp2px
import com.songcha.module_main.R

class QmyAchievementDialog(context: Context,val mAchievementName:String,val mAchievementDesc:String,val mMedalUrl:String):CustomDialog(context) {

    init {
        setWidth(288.dp2px())
        custom()
    }

    override fun hasView(): Boolean {
        return true
    }

    override fun getView(root: ViewGroup): View? {
        val view = LayoutInflater.from(context).inflate(R.layout.main_dialog_qmy_achievement,root,false)
        val tvTitle = view.findViewById<TextView>(R.id.main_tv_title)
        val tvLjCount = view.findViewById<TextView>(R.id.main_tv_lj_count)
        val btn = view.findViewById<FrameLayout>(R.id.main_btn)
        val ivMedal = view.findViewById<ImageView>(R.id.main_iv_medal)
        GlideUtil.loadNetImage(ivMedal, mMedalUrl,DiskCacheStrategy.NONE)
        tvTitle.text = "恭喜你达成${mAchievementName}成就"
        tvLjCount.text = mAchievementDesc
        btn.setOnClickListener {
            dismiss()
        }
        return view
    }

}